<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS-SDK测试页</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
  <link rel="stylesheet" href="{:ADDON_PUBLIC_PATH}/css/style.css?ts=1420775603">
</head>
<body ontouchstart="">
<div class="wxapi_container">
    <div class="wxapi_index_container">
      <ul class="label_box lbox_close wxapi_index_list">
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-basic">基础接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-share">分享接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-image">图像接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-voice">音频接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-smart">智能接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-device">设备信息接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-location">地理位置接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-webview">界面操作接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-scan">微信扫一扫接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-shopping">微信小店接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-card">微信卡券接口</a></li>
        <li class="label_item wxapi_index_item"><a class="label_inner" href="#menu-pay">微信支付接口</a></li>
      </ul>
    </div>
    <div class="lbox_close wxapi_form">
	
	<h3 id="menu-pay">微信支付接口</h3>
    <span class="desc">打赏UCToo开源项目1元</span>
    <button class="btn btn_primary" id="chooseWXPay">chooseWXPay</button>
	
      <h3 id="menu-basic">基础接口</h3>
      <span class="desc">判断当前客户端是否支持指定JS接口</span>
      <button class="btn btn_primary" id="checkJsApi">checkJsApi</button>

      <h3 id="menu-share">分享接口</h3>
      <span class="desc">获取“分享到朋友圈”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareTimeline">onMenuShareTimeline</button>
      <span class="desc">获取“分享给朋友”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareAppMessage">onMenuShareAppMessage</button>
      <span class="desc">获取“分享到QQ”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareQQ">onMenuShareQQ</button>
      <span class="desc">获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口</span>
      <button class="btn btn_primary" id="onMenuShareWeibo">onMenuShareWeibo</button>

      <h3 id="menu-image">图像接口</h3>
      <span class="desc">拍照或从手机相册中选图接口</span>
      <button class="btn btn_primary" id="chooseImage">chooseImage</button>
      <span class="desc">预览图片接口</span>
      <button class="btn btn_primary" id="previewImage">previewImage</button>
      <span class="desc">上传图片接口</span>
      <button class="btn btn_primary" id="uploadImage">uploadImage</button>
      <span class="desc">下载图片接口</span>
      <button class="btn btn_primary" id="downloadImage">downloadImage</button>

      <h3 id="menu-voice">音频接口</h3>
      <span class="desc">开始录音接口</span>
      <button class="btn btn_primary" id="startRecord">startRecord</button>
      <span class="desc">停止录音接口</span>
      <button class="btn btn_primary" id="stopRecord">stopRecord</button>
      <span class="desc">播放语音接口</span>
      <button class="btn btn_primary" id="playVoice">playVoice</button>
      <span class="desc">暂停播放接口</span>
      <button class="btn btn_primary" id="pauseVoice">pauseVoice</button>
      <span class="desc">停止播放接口</span>
      <button class="btn btn_primary" id="stopVoice">stopVoice</button>
      <span class="desc">上传语音接口</span>
      <button class="btn btn_primary" id="uploadVoice">uploadVoice</button>
      <span class="desc">下载语音接口</span>
      <button class="btn btn_primary" id="downloadVoice">downloadVoice</button>

      <h3 id="menu-smart">智能接口</h3>
      <span class="desc">识别音频并返回识别结果接口</span>
      <button class="btn btn_primary" id="translateVoice">translateVoice</button>

      <h3 id="menu-device">设备信息接口</h3>
      <span class="desc">获取网络状态接口</span>
      <button class="btn btn_primary" id="getNetworkType">getNetworkType</button>

      <h3 id="menu-location">地理位置接口</h3>
      <span class="desc">使用微信内置地图查看位置接口</span>
      <button class="btn btn_primary" id="openLocation">openLocation</button>
      <span class="desc">获取地理位置接口</span>
      <button class="btn btn_primary" id="getLocation">getLocation</button>

      <h3 id="menu-webview">界面操作接口</h3>
      <span class="desc">隐藏右上角菜单接口</span>
      <button class="btn btn_primary" id="hideOptionMenu">hideOptionMenu</button>
      <span class="desc">显示右上角菜单接口</span>
      <button class="btn btn_primary" id="showOptionMenu">showOptionMenu</button>
      <span class="desc">关闭当前网页窗口接口</span>
      <button class="btn btn_primary" id="closeWindow">closeWindow</button>
      <span class="desc">批量隐藏功能按钮接口</span>
      <button class="btn btn_primary" id="hideMenuItems">hideMenuItems</button>
      <span class="desc">批量显示功能按钮接口</span>
      <button class="btn btn_primary" id="showMenuItems">showMenuItems</button>
      <span class="desc">隐藏所有非基础按钮接口</span>
      <button class="btn btn_primary" id="hideAllNonBaseMenuItem">hideAllNonBaseMenuItem</button>
      <span class="desc">显示所有功能按钮接口</span>
      <button class="btn btn_primary" id="showAllNonBaseMenuItem">showAllNonBaseMenuItem</button>

      <h3 id="menu-scan">微信扫一扫</h3>
      <span class="desc">调起微信扫一扫接口</span>
      <button class="btn btn_primary" id="scanQRCode0">scanQRCode(微信处理结果)</button>
      <button class="btn btn_primary" id="scanQRCode1">scanQRCode(直接返回结果)</button>

      <h3 id="menu-shopping">微信小店接口</h3>
      <span class="desc">跳转微信商品页接口</span>
      <button class="btn btn_primary" id="openProductSpecificView">openProductSpecificView</button>

      <h3 id="menu-card">微信卡券接口</h3>
      <span class="desc">批量添加卡券接口</span>
      <button class="btn btn_primary" id="addCard">addCard</button>
      <span class="desc">调起适用于门店的卡券列表并获取用户选择列表</span>
      <button class="btn btn_primary" id="chooseCard">chooseCard</button>
      <span class="desc">查看微信卡包中的卡券接口</span>
      <button class="btn btn_primary" id="openCard">openCard</button>

    
  </div>
</div>

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"> </script>

  <script>
    wx.config({
      debug: false,
      appId: '{$js_sign['appid']}',
      timestamp: {$js_sign['timestamp']},
      nonceStr: '{$js_sign['noncestr']}',
      signature: '{$js_sign['signature']}',
      jsApiList: [
        // 所有要调用的 API 都要加到这个列表中
        'checkJsApi',
        'onMenuShareTimeline',
        'onMenuShareAppMessage',
        'onMenuShareQQ',
        'onMenuShareWeibo',
        'hideMenuItems',
        'showMenuItems',
        'hideAllNonBaseMenuItem',
        'showAllNonBaseMenuItem',
        'translateVoice',
        'startRecord',
        'stopRecord',
        'onRecordEnd',
        'playVoice',
        'pauseVoice',
        'stopVoice',
        'uploadVoice',
        'downloadVoice',
        'chooseImage',
        'previewImage',
        'uploadImage',
        'downloadImage',
        'getNetworkType',
        'openLocation',
        'getLocation',
        'hideOptionMenu',
        'showOptionMenu',
        'closeWindow',
        'scanQRCode',
        'chooseWXPay',
        'openProductSpecificView',
        'addCard',
        'chooseCard',
        'openCard'
      ]
    });
	
	wx.ready(function () {
      // 在这里调用 API
	  // 10 微信支付接口
  // 10.1 发起一个支付请求

  document.querySelector('#chooseWXPay').onclick = function () {
    wx.chooseWXPay({
              {$jsApiParameters}
      });
  };
  // 2. 分享接口
  // 2.1 监听“分享给朋友”，按钮点击、自定义分享内容及分享结果接口
  
    wx.onMenuShareAppMessage({
      title: 'UCToo 微信Jssdk演示',
      desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。',
      link: '{$share_url}',
      imgUrl: '{:get_addoncover_url( "Jssdk" )}',
      trigger: function (res) {
      	alert("点击分享：" +JSON.stringify(res));
          // 用户确认分享后执行的回调函数
      },
      success: function (res) {
      	alert("分享成功：" +JSON.stringify(res));
          // 用户确认分享后执行的回调函数
      },
      cancel: function (res) {
      	alert("取消分享：" +JSON.stringify(res));
          // 用户取消分享后执行的回调函数
      },
      fail:function (res) {
      	alert("分享失败：" +JSON.stringify(res));
      }
    });
    

  // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
 
    wx.onMenuShareTimeline({
      title: 'UCToo 微信Jssdk演示',
      desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。',
      link: '{$share_url}',
      imgUrl: '{:get_addoncover_url( "Jssdk" )}',
      trigger: function (res) {
        	alert("点击分享：" +JSON.stringify(res));
            // 用户确认分享后执行的回调函数
        },
        success: function (res) {
        	alert("分享成功：" +JSON.stringify(res));
            // 用户确认分享后执行的回调函数
        },
        cancel: function (res) {
        	alert("取消分享：" +JSON.stringify(res));
            // 用户取消分享后执行的回调函数
        },
        fail:function (res) {
        	alert("分享失败：" +JSON.stringify(res));
        }
    });
    

  // 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
  
    wx.onMenuShareQQ({
      title: 'UCToo 微信Jssdk演示',
      desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。',
      link: '{$share_url}',
      imgUrl: '{:get_addoncover_url( "Jssdk" )}',
      trigger: function (res) {
      	alert("点击分享：" +JSON.stringify(res));
          // 用户确认分享后执行的回调函数
      },
      success: function (res) {
      	alert("分享成功：" +JSON.stringify(res));
          // 用户确认分享后执行的回调函数
      },
      cancel: function (res) {
      	alert("取消分享：" +JSON.stringify(res));
          // 用户取消分享后执行的回调函数
      },
      fail:function (res) {
      	alert("分享失败：" +JSON.stringify(res));
      }
    });
    
  
  // 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
  
    wx.onMenuShareWeibo({
      title: 'UCToo 微信Jssdk演示',
      desc: '微信公众平台php开发包,细化各项接口操作,支持链式调用。',
      link: '{$share_url}',
      imgUrl: '{:get_addoncover_url( "Jssdk" )}',
      trigger: function (res) {
        	alert("点击分享：" +JSON.stringify(res));
            // 用户确认分享后执行的回调函数
        },
        success: function (res) {
        	alert("分享成功：" +JSON.stringify(res));
            // 用户确认分享后执行的回调函数
        },
        cancel: function (res) {
        	alert("取消分享：" +JSON.stringify(res));
            // 用户取消分享后执行的回调函数
        },
        fail:function (res) {
        	alert("分享失败：" +JSON.stringify(res));
        }
    });
    
});
    wx.error(function (res) {
      alert(res.errMsg);
    });
</script>
  <script src="{:ADDON_PUBLIC_PATH}/js/jsapi-demo-6.1.js"> </script>
  </body>
</html>
